package org.com.Controller;


import Entity.Blog;
import org.com.Service.IBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 277
 * @since 2025-09-23
 */
@RestController
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    private IBlogService blogService;

    @PostMapping("/upload")
    public String uploadFile(MultipartFile file, String content, String title) {
        return blogService.uploadFile(file, content, title);
    }

    @GetMapping("/list")
    public List<Blog> list() {
        return blogService.showblog();
    }

    @DeleteMapping("/{id}")
    public boolean delete(@PathVariable Integer id) {
        return blogService.deleteWithCommunity(id);
    }


}
